﻿using System;
using System.Text;
using System.Windows.Input;
using MFW = MslDiary.Framework;

namespace MslDiary.ViewModel
{
    public class AboutViewModel : MslDiary.Framework.ViewModelBase
    {
        public AboutViewModel()
        {
            this.AccessUsCommand = new CommandBase((Object url) =>
            {
                if (url != null)
                {
                    string link = url.ToString();
                    System.Diagnostics.Process.Start("iexplore.exe", link);
                }
            });
            this.WindowLoadCommand = new CommandBase((Object window) =>
            {

            });
            this.LookInstructionCommand = new CommandBase((Object paramter) =>
            {
                //System.Diagnostics.Process.Start("notepad.exe", MFW.Gloable.StartPath + "\\" + "说明.txt");
                System.Diagnostics.Process.Start("iexplore.exe", MFW.Gloable.StartPath + "\\" + "说明.htm");
            });
            this.CloseCommand = new CommandBase((Object window) =>
            {
                if (window is System.Windows.Window) // 这是从Button.Command事件调用过来的
                    (window as System.Windows.Window).Close();
            });
            StringBuilder sbMsg = new StringBuilder();
            sbMsg.Append("版 本 号：V");
            sbMsg.Append(MslDiary.Utils.Helper.Instance.GetVersion() + "\r\n");
            sbMsg.Append("版权所有：m.sh.lin0328@163.com \r\n");
            sbMsg.Append("Copyright@ 2015 Lin.All Right Reserved.\r\n");
            sbMsg.Append("作品说明：本作品只用于交流与免费使用, 如若转载, 请注明作者与出处。");
            this.VersionInfo = sbMsg.ToString();
        }

        #region 属性

        /// <summary> 版本信息 </summary>
        public string VersionInfo { get; set; }

        #endregion
        #region 命令
        /// <summary> 联系我们</summary>
        public ICommand AccessUsCommand { get; set; }
        /// <summary> 说明</summary>
        public ICommand LookInstructionCommand { get; set; }
        public ICommand CloseCommand { get; set; }
        public ICommand WindowLoadCommand { get; set; }
        #endregion
        #region 方法

        #endregion
    }
}
